#include "kukaforcecontrolinstance.h"
#include "kukaforcecontrolinstance_global.h"

static KUKAForceControlInstance* pKUKAForceControlInstance = nullptr;

short PLU_KPluginInstanceCreate(short Local_Remote){
    if(pKUKAForceControlInstance == nullptr){
        pKUKAForceControlInstance = new KUKAForceControlInstance(Local_Remote);
    }
    return 1;
}

short PLU_KPluginInstanceDelete(){
    if(pKUKAForceControlInstance != nullptr){
        delete pKUKAForceControlInstance;
    }
    return 1;
}

bool PLU_KPluginInstanceExists(){
    if(pKUKAForceControlInstance != nullptr) return true;
    else                                     return false;
}

QWidget* PLU_KPluginInstanceUiRegesiter(){
    return pKUKAForceControlInstance->getUiHandle();

}

void TASK_kukaloop_KUKADataProcess(){
    if(pKUKAForceControlInstance != nullptr){
        pKUKAForceControlInstance->task_kukaloop_KUKAProcess();
    }
}

void TASK_maininit_ForceSensorConnect(){
    if(pKUKAForceControlInstance != nullptr){
        pKUKAForceControlInstance->task_maininit_ForceSensorConnect();
    }
}

void TASK_mainloop_ForceSensorLoopRun(){
    if(pKUKAForceControlInstance != nullptr){
        pKUKAForceControlInstance->task_mainloop_ForceSensorLoopRun();
    }
}

void TASK_uifast_ForceScopeUpdate(){
    if(pKUKAForceControlInstance != nullptr){
        pKUKAForceControlInstance->task_uifast_ForceScopeUpdate();
    }
}

void TASK_uifast_RobotScopeUpdate(){
    if(pKUKAForceControlInstance != nullptr){
        pKUKAForceControlInstance->task_uifast_RobotScopeUpdate();
    }
}

void TASK_RemoteDataRecv(QByteArray Data){
    if(pKUKAForceControlInstance != nullptr){
        pKUKAForceControlInstance->task_com_RemoteDataRecv(Data);
    }
}

void TASK_RemoteDataSend(QByteArray& Data){
    if(pKUKAForceControlInstance != nullptr){
        pKUKAForceControlInstance->task_com_RemoteDataSend(Data);
    }
}

void TASK_uifast_UiDataUpdate(){
    if(pKUKAForceControlInstance != nullptr){
        pKUKAForceControlInstance->task_uifast_UiDataUpdate();
    }
}
